<%@page import="com.u.character.Role"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<%
	HttpSession httpSession = request.getSession();
	Role role = (Role)httpSession.getAttribute("Role");
	if(!role.getUseracc().equals("21000")){
%>
	<script>
		alert("账号权限不足!");
		window.location.href="/r/login.html";
	</script>
<%
	}
%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" http-equiv="Content-Type" content="width=device-width, initial-scale=1; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="css/amazeui.min.css"/>
		<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>	
		<script type="text/javascript" src="js/amazeui.min.js" ></script>
		<title>超级权限</title>
	</head>
	<body>
		<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
	    <div class="am-header-left am-header-nav">
	        <a href="/r/eventList.html" class="" >
	            <i class="am-header-icon am-icon-angle-left" style="font-size: 22px;"></i>
	        </a>
	    </div>
	    <h1 class="am-header-title">
	        	超级权限
	    </h1>
	    <div class="am-header-right am-header-nav">
          	<a data-am-modal="{target: '#newLog'}" href="#right-link" class="">
           	
          	</a>
      	</div>
	</header>
		
		<div style="padding-top: 6px;background: #8080807a;">
			<div id="downloadFile" class="am-g" style="background: white;padding-top: 10px;;padding-left: 5px;padding-right: 4px;border-bottom: solid 1px #80808052;padding-right: 4px;">
				<div class="am-u-sm-9">
					<p style="font-size: 18px;margin-bottom: 10px;">导出账号信息</p>
				</div>
				<div class="am-u-sm-3" style="text-align: right;">
					<p style="line-height: 29px;font-weight: 500;color: grey;margin-bottom: 10px;"> 
						<i class="am-header-icon am-icon-angle-right" ></i>
					</p>
				</div>
			</div>
			
			<div id="uploadFile" class="am-g" style="background: white;padding-top: 10px;;padding-left: 5px;padding-right: 4px;border-bottom: solid 1px #80808052;padding-right: 4px;">
				<div class="am-u-sm-9">
					<p style="font-size: 18px;margin-bottom: 10px;">导入账号信息</p>
				</div>
				<div class="am-u-sm-3" style="text-align: right;">
					<p style="line-height: 29px;font-weight: 500;color: grey;margin-bottom: 10px;">
						<i class="am-header-icon am-icon-angle-right" ></i>
					</p>
				</div>
			</div>
			
			<div id="init-password" class="am-g" style="background: white;padding-top: 10px;;padding-left: 5px;padding-right: 4px;border-bottom: solid 1px #80808052;padding-right: 4px;">
				<div class="am-u-sm-9">
					<p style="font-size: 18px;margin-bottom: 10px;">重置密码</p>
				</div>
				<div class="am-u-sm-3" style="text-align: right;">
					<p style="line-height: 29px;font-weight: 500;color: grey;margin-bottom: 10px;">
						<i class="am-header-icon am-icon-angle-right" ></i>
					</p>
				</div>
			</div>
			
		</div>
		
		<div class="am-modal am-modal-prompt" tabindex="-1" id="initPassword">
		  	<div class="am-modal-dialog">
		    	<div class="am-modal-hd">重置密码</div>
		   		 <div class="am-modal-bd">
		   		 		<table class="am-table" style="font-size: 14px;text-align: right;margin-bottom: -4px;">
		   		 			<tr>
		   		 				<td>账号：  </td>
		   		 				<td>
		   		 					<input id="useracc1" type="number"/>
		   		 				</td>
		   		 			</tr>
		   		 			<tr>
		   		 				<td>再输一遍</td>
		   		 				<td>
		   		 					<input id="useracc2" type="number"/>
		   		 				</td>
		   		 			</tr>
		   		 		</table>
		      		
		     		
		    	</div>
		    	<div class="am-modal-footer">
		     		<span class="am-modal-btn" data-am-modal-cancel>取消</span>
		      		<span class="am-modal-btn" data-am-modal-confirm>保存</span>
		   		 </div>
		  	</div>
		</div>
		
		<div class="am-modal am-modal-prompt" tabindex="-1" id="upload">
		  	<div class="am-modal-dialog">
		    	<div class="am-modal-hd">导入账号信息(xls格式)</div>
		   		 <div class="am-modal-bd">
		   		 	<table class="am-table" style="font-size: 14px;margin-bottom: 0px;">
		   		 		<tr>
		   		 			<td style="padding-left: 0px;">
			   		 			<form action="/r/UploadFile" method="POST" enctype="MULTIPART/FORM-DATA">
								<input type="file" name="file1" size="40"/>
								<input id="submit" type="submit" value="upload" style="display:none"/>
							</form>
		   		 			</td>
		   		 		</tr>
		   		 	</table>
		    	</div>
		    	<div class="am-modal-footer">
		     		<span class="am-modal-btn" data-am-modal-cancel>取消</span>
		      		<span class="am-modal-btn" data-am-modal-confirm>保存</span>
		   		 </div>
		  	</div>
		</div>
		
		<div class="am-modal am-modal-prompt" tabindex="-1" id="download">
		  	<div class="am-modal-dialog">
		    	<div class="am-modal-hd">导出账号信息表</div>
		   		 <div class="am-modal-bd">
					<h3>确认导出?</h3>
		    	</div>
		    	<div class="am-modal-footer">
		     		<span class="am-modal-btn" data-am-modal-cancel>取消</span>
		      		<span class="am-modal-btn" data-am-modal-confirm>确认</span>
		   		 </div>
		  	</div>
		</div>
		
	</body>
	
	<script>
		$(function() {
		  	$('#downloadFile').on('click', function() {
		    	$('#download').modal({
		     		relatedTarget: this,
		      		onConfirm: function(e) {
		      			window.location.href="/r/SuperRootServlet?method=getUserList";
		      		},
		      		onCancel: function(e) {
		        		
		      		}
		    	});
		  	});
		});
		
		$(function() {
		  	$('#uploadFile').on('click', function() {
		    	$('#upload').modal({
		     		relatedTarget: this,
		      		onConfirm: function(e) {
		        		document.getElementById("submit").click();
		      		},
		      		onCancel: function(e) {
		        		
		      		}
		    	});
		  	});
		});
		
		$(function() {
		  	$('#init-password').on('click', function() {
		    	$('#initPassword').modal({
		    		
		     		relatedTarget: this,
		      		onConfirm: function(e) {
		      			
		      			var value1 = document.getElementById("useracc1").value;
		      			var value2 = document.getElementById("useracc2").value;
		      			if(value1 == value2){
		      				$.ajax({
			      		        type: "post",
			      		        url: "/r/InitPasswordServlet?useracc="+value1,
			      		        dataType: "json",
			      		        success: function (data, textStatus) {    	
			      		        	alert(data[0]);
			      		        },
			      		        error: function (XMLHttpRequest, textStatus, errorThrown) {
			      		        	alert("修改失败");
			      		        },
			      		        complete: function (XMLHttpRequest, textStatus) {
			      		            this; // 调用本次AJAX请求时传递的options参数
			      		        }
			      		   });
		      			}else{
		      				alert("两次输入账号不一致");
		      			}
		      			
		      		},
		      		onCancel: function(e) {
		        		
		      		}
		    	});
		  	});
		});
		
	</script>
</html>
